package com.wannengbang.cloudleader.homepage;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.ethanhua.skeleton.Skeleton;
import com.ethanhua.skeleton.SkeletonScreen;
import com.gyf.immersionbar.ImmersionBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.wannengbang.cloudleader.R;
import com.wannengbang.cloudleader.base.Adapter_ViewPager_Fragment;
import com.wannengbang.cloudleader.base.BaseActivity;
import com.wannengbang.cloudleader.base.BaseFragment;
import com.wannengbang.cloudleader.base.DataCallBack;
import com.wannengbang.cloudleader.bean.IndexMessageBean;
import com.wannengbang.cloudleader.homepage.adapter.MessageListAdapter;
import com.wannengbang.cloudleader.homepage.model.HomePageModelImpl;
import com.wannengbang.cloudleader.homepage.model.IHomePageModel;
import com.wannengbang.cloudleader.mine.MyMessageFragment;
import com.wannengbang.cloudleader.mine.SystemMessageFragment;
import com.wannengbang.cloudleader.widget.AppTitleBar;
import com.wannengbang.cloudleader.widget.NoScrollViewPager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MessageCenterActivity extends BaseActivity {

    @BindView(R.id.viewPager)
    NoScrollViewPager viewPager;
    @BindView(R.id.ll_left)
    LinearLayout llLeft;
    @BindView(R.id.tv_share_money)
    TextView tvShareMoney;
    @BindView(R.id.tv_return_money)
    TextView tvReturnMoney;
    private List<String> mDataList;
    private Adapter_ViewPager_Fragment adapter_viewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_center);
        ButterKnife.bind(this);
        initView();
    }

    public void initView() {
        mDataList = new ArrayList<>();
        mDataList.add("系统消息");
        mDataList.add("我的消息");
        //ViewPager的适配器
        List<BaseFragment> fragmentList = new ArrayList<>();
        fragmentList.add(new SystemMessageFragment());
        fragmentList.add(new MyMessageFragment());
        adapter_viewPager = new Adapter_ViewPager_Fragment(getSupportFragmentManager(), fragmentList, mDataList);
        viewPager.setAdapter(adapter_viewPager);
        viewPager.setOffscreenPageLimit(2);
    }


    @OnClick({R.id.ll_left, R.id.tv_share_money, R.id.tv_return_money})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_left:
                finish();
                break;
            case R.id.tv_share_money:
                tvShareMoney.setTextColor(getResources().getColor(R.color.theme_color));
                tvShareMoney.setBackgroundResource(R.drawable.shape_left_conner_white4);
                tvReturnMoney.setTextColor(getResources().getColor(R.color.white));
                tvReturnMoney.setBackgroundResource(R.drawable.shape_right_conner_theme4);
                viewPager.setCurrentItem(0);
                break;
            case R.id.tv_return_money:
                tvShareMoney.setTextColor(getResources().getColor(R.color.white));
                tvShareMoney.setBackgroundResource(R.drawable.shape_left_conner_theme4);
                tvReturnMoney.setTextColor(getResources().getColor(R.color.theme_color));
                tvReturnMoney.setBackgroundResource(R.drawable.shape_right_conner_white4);
                viewPager.setCurrentItem(1);
                break;
        }
    }
}
